﻿using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Library.WebControls.SimpleGridView {
	[ToolboxItem(false)]
	[DesignTimeVisible(false)]
	public class SpGvRowItemTemplate : TableRow, IDataItemContainer {
		internal SpGvRowItemTemplate() {
		}

		public string Key {
			get {
				return Attributes["__spgvitemkey_"];
			}
			set { Attributes["__spgvitemkey_"] = value; }
		}
		public object DataItem {
			get;
			internal set;
		}

		public int DataItemIndex {
			get;
			internal set;
		}

		public int DisplayIndex {
			get;
			internal set;
		}
		public override Control FindControl(string id) {
			foreach (TableCell cell in Cells) {
				foreach (Control ctr in cell.Controls) {
					if (ctr.ID == id) return ctr;
				}
			}

			return null;
		}
	}
}
